python filter list of dictionaries by value

39

fl = list(filter(lambda x: x['first'] == 'Christian', dictlist))

# you can't use `.property` because this is a dictionary, not a object
fl[0]['last']
# returns Doppler
dict_you_want = { your_key: old_dict[your_key] for your_key in your_keys }

Comments

Submit
0 Comments